define(["jquery","util","imgCrop"],function($,xy_util,xy_imgCrop){
	return admin = {
		ready: function(){
				this.initUploadImg();
				this.bindAdminEvent();
		},	
		bindAdminEvent: function(){
			$(".J_edit_famous").on("click", function(){
				var $editItem = $('<div class="edit-item mask-lock"><i class="icon-plus upload-img"></i></div>')
				$(".famous-websites-item").append($editItem);
				$(this).hide().siblings(".J_save_famous").show();
			})

			$(".J_save_famous").on("click", function(){
				$(this).hide().siblings(".J_edit_famous").show();
				$(".famous-websites-item").find(".edit-item").remove();
			})

			$(".J_edit_news").on("click", function(){
				window.imgAnimate.MdsSlideFadeStop();
				$(".slide-wrapper").addClass("stopAnimate");
				var index = $(".js_channel.active").index();
				var node = $(".slide-wrapper").eq(index);
				var $li = node.find("ul.list li");
				$li.css({
					"display":"inline-block",
					"position":"relative",
					"margin-top":"10px"
				})
				$li.animate({
					"float":"left",
					"width":"150px",
					"height":"150px"
				})

				var $editItem = $('<div class="edit-item mask-lock"><i class="icon-plus upload-img"></i></div>')
				$li.append($editItem);
				$(this).hide().siblings(".J_save_news").show();

				var $js_link = node.parents(".tab-pane").find(".js_link");
				$.each($js_link, function(){
					var _text = $.trim($(this).text());
					
					$(this).replaceWith('<input type="text" value="'+_text+'"/><input type="text"/>');
				})
				

			})
		},

		 initUploadImg: function(){
			 xy_imgCrop.init({
                fileBtnId:"fileinput",
                delBtnId:"delete",
                displayImg:$("#client_img"),
                dataId:"dataId"
            })
		 }
	}
})


